Skip to content

Conversation

@seisman
Copy link
Member

@seisman seisman commented Jan 14, 2026

With changes in #4329, now it's possible to have a single step for building GMT source code on all platforms.

@seisman seisman added the run/test-gmt-dev Trigger the GMT Dev Tests workflow in PR label Jan 14, 2026
- name: Build GMT on Windows
shell: bash
- name: Build GMT from source
shell: bash -l {0}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably remove this since already set in defaults above. Should have done this in #4329 (comment)

Suggested change
shell: bash -l {0}

cd ../../
rm -rf gmt
env:
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See if this would work, based on https://docs.github.com/en/actions/reference/workflows-and-actions/expressions#example

Suggested change
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir
CMAKE_PREFIX_PATH: ${{ startsWith(matrix.os, 'windows') && '' || '-DCMAKE_PREFIX_PATH=$MAMBA_ROOT_PREFIX/envs/pygmt/Library' }}
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't try this, because now we need to set CMAKE_PREFIX_PATH to different values based on the OS.

Comment on lines 114 to 116
CMAKE_PREFIX_PATH="-DCMAKE_PREFIX_PATH=$MAMBA_ROOT_PREFIX/envs/pygmt/Library"
else
CMAKE_PREFIX_PATH=""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CMAKE_PREFIX_PATH="-DCMAKE_PREFIX_PATH=$MAMBA_ROOT_PREFIX/envs/pygmt/Library"
else
CMAKE_PREFIX_PATH=""

@seisman seisman added this to the 0.19.0 milestone Jan 14, 2026
@seisman
Copy link
Member Author

seisman commented Jan 14, 2026

Still not lucky. It seems that we need shell: bash -l ${0} (the default) for macOS/Linux but shell: bash for Windows.

@seisman
Copy link
Member Author

seisman commented Jan 14, 2026

Still not lucky. It seems that we need shell: bash -l ${0} (the default) for macOS/Linux but shell: bash for Windows.

I still don’t fully understand the underlying cause, but the observation appears reliable.

On Windows, the login shell seems to interfere with the Visual Studio activation script ("C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"), so a non-login shell is required and CMAKE_PREFIX_PATH must point to "$MAMBA_ROOT_PREFIX/envs/pygmt/Library".

On Linux/macOS, a login shell automatically activates the environment, and CMake locates the libraries without help; with a non-login shell, we need to set CMAKE_PREFIX_PATH to "$MAMBA_ROOT_PREFIX/envs/pygmt".

Now building source codes succeeds on all platforms. The failing test is unrelated.

CI Runs: https://github.com/GenericMappingTools/pygmt/actions/runs/20982948742

@seisman seisman added maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog needs review This PR has higher priority and needs review. and removed run/test-gmt-dev Trigger the GMT Dev Tests workflow in PR labels Jan 14, 2026
@seisman seisman marked this pull request as ready for review January 14, 2026 04:58
Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just curious though, you know what's up with the skipped job at https://github.com/GenericMappingTools/pygmt/actions/runs/20982938310/job/60311514437?

@seisman seisman merged commit fba6e83 into main Jan 14, 2026
11 of 19 checks passed
@seisman seisman deleted the ci/test-dev branch January 14, 2026 06:07
@seisman seisman removed the needs review This PR has higher priority and needs review. label Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants